﻿Imports System
Imports System.Workflow.ComponentModel
Imports System.Workflow.ComponentModel.Serialization

Namespace System.Workflow.ComponentModel.Compiler
    Friend Class BindValidatorHelper
        ' Methods
        Friend Shared Function GetActivityType(ByVal serviceProvider As IServiceProvider, ByVal refActivity As Activity) As Type
            Dim type As Type = Nothing
            Dim str As String = [TryCast](refActivity.GetValue(WorkflowMarkupSerializer.XClassProperty),String)
            If ((Not refActivity.Site Is Nothing) AndAlso Not String.IsNullOrEmpty(str)) Then
                Dim service As ITypeProvider = [TryCast](serviceProvider.GetService(GetType(ITypeProvider)),ITypeProvider)
                If ((Not service Is Nothing) AndAlso Not String.IsNullOrEmpty(str)) Then
                    type = service.GetType(str, False)
                End If
                Return type
            End If
            Return refActivity.GetType
        End Function

    End Class
End Namespace

